package com.kolaxy;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

/**
 * <p>todo</p>
 *
 * @author zhourunjin
 * @date 2020/6/8 19:55
 */
public class TCPClient {

    public static void main(String[] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 9999);

        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("haha".getBytes());

        InputStream inputStream = socket.getInputStream();

        byte[] b = new byte[10];

        inputStream.read(b);

        System.out.println(new String(b));
    }
}
